from building import *

cwd = GetCurrentDir()
CPPPATH = [cwd]
src = []

if GetDepend('SUPPORT_RTC_ASM32X'):
    src += Glob('RTC_ASM32x.c') 
elif GetDepend('SUPPORT_RTC_DS1302'):
    src += Glob('RTC_DS1302.c') 
    CPPPATH.append(cwd + "/DS1302")
    if GetDepend('SUPPORT_RTC_DS1302_IO'):
        src += Glob('DS1302/DS1302Drv.c')  
    elif GetDepend('SUPPORT_RTC_DS1302_SPI3_MIO'):
        src += Glob('DS1302/DS1302Drv_Spi3mIo.c')          
elif GetDepend('SUPPORT_RTC_DS1307'):
    src += Glob('RTC_DS1307.c')  
elif GetDepend('SUPPORT_RTC_HC32X_F4'):
    src += Glob('RTC_HC32xF4.c') 
elif GetDepend('SUPPORT_RTC_STM32F4X'):
    src += Glob('RTC_STM32F4x.c') 
elif GetDepend('SUPPORT_RTC_STM32F4XX'):
    src += Glob('RTC_STM32F4xx.c')    

if GetDepend('SUPPORT_RTC_CAL'):
    src += Glob('RTC_Cal.c') 
    if GetDepend('SUPPORT_RTC_ASM32X'):
      src += Glob('RTC_CalASM32x.c') 
    if GetDepend('SUPPORT_RTC_HC32X_F4'):
      src += Glob('RTC_CalHC32xF4.c') 

if GetDepend('SUPPORT_RTC_BAK'):
    src += Glob('RTC_Bak.c')  

if GetDepend('SUPPORT_RTC_ZIP_TIME'):
    src += Glob('RTC_cbZipTime.c')   

#增加SUPPORT_EX_PREINCLUDE定义以预包含Preinclude.h
predefine = ['SUPPORT_EX_PREINCLUDE']
group = DefineGroup('rtc', src, depend = [''], CPPPATH=CPPPATH, CPPDEFINES = predefine)
Return('group')
